home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / digclk12 / digclock.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-02  |  8.9 KB  |  270 lines

  1. VERSION 2.00
  2. Begin Form frmClock 
  3.    BorderStyle     =   1  'Fixed Single
  4.    ClientHeight    =   735
  5.    ClientLeft      =   3240
  6.    ClientTop       =   855
  7.    ClientWidth     =   2730
  8.    ControlBox      =   0   'False
  9.    ForeColor       =   &H00FF0000&
  10.    Height          =   1140
  11.    Icon            =   DIGCLOCK.FRX:0000
  12.    Left            =   3180
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    Picture         =   DIGCLOCK.FRX:0302
  17.    ScaleHeight     =   735
  18.    ScaleWidth      =   2730
  19.    Top             =   510
  20.    Width           =   2850
  21.    Begin PictureClip picNumbers 
  22.       Cols            =   13
  23.       Location        =   "3705,525,1170,-60"
  24.       Picture         =   DIGCLOCK.FRX:0520
  25.    End
  26.    Begin SSPanel pnlClock 
  27.       BackColor       =   &H00C0C0C0&
  28.       BevelInner      =   1  'Inset
  29.       BevelWidth      =   2
  30.       Font3D          =   3  'Inset w/light shading
  31.       ForeColor       =   &H00800000&
  32.       Height          =   735
  33.       Left            =   0
  34.       TabIndex        =   0
  35.       Top             =   0
  36.       Width           =   2730
  37.       Begin PictureBox picClock 
  38.          BackColor       =   &H00000000&
  39.          BorderStyle     =   0  'None
  40.          Height          =   525
  41.          Left            =   105
  42.          ScaleHeight     =   525
  43.          ScaleWidth      =   2505
  44.          TabIndex        =   1
  45.          Top             =   105
  46.          Width           =   2505
  47.          Begin Image imgNum 
  48.             Height          =   525
  49.             Index           =   7
  50.             Left            =   2205
  51.             Top             =   0
  52.             Width           =   285
  53.          End
  54.          Begin Image imgNum 
  55.             Height          =   525
  56.             Index           =   6
  57.             Left            =   1890
  58.             Top             =   0
  59.             Width           =   285
  60.          End
  61.          Begin Image imgNum 
  62.             Height          =   525
  63.             Index           =   5
  64.             Left            =   1575
  65.             Top             =   0
  66.             Width           =   285
  67.          End
  68.          Begin Image imgNum 
  69.             Height          =   525
  70.             Index           =   0
  71.             Left            =   0
  72.             Top             =   0
  73.             Width           =   285
  74.          End
  75.          Begin Image imgNum 
  76.             Height          =   525
  77.             Index           =   1
  78.             Left            =   315
  79.             Top             =   0
  80.             Width           =   285
  81.          End
  82.          Begin Image imgNum 
  83.             Height          =   525
  84.             Index           =   2
  85.             Left            =   630
  86.             Top             =   0
  87.             Width           =   285
  88.          End
  89.          Begin Image imgNum 
  90.             Height          =   525
  91.             Index           =   3
  92.             Left            =   945
  93.             Top             =   0
  94.             Width           =   285
  95.          End
  96.          Begin Image imgNum 
  97.             Height          =   525
  98.             Index           =   4
  99.             Left            =   1260
  100.             Top             =   0
  101.             Width           =   285
  102.          End
  103.       End
  104.    End
  105.    Begin Timer Timer1 
  106.       Interval        =   1000
  107.       Left            =   3120
  108.       Top             =   1680
  109.    End
  110.    Begin Image imgGreen 
  111.       Height          =   525
  112.       Left            =   0
  113.       Picture         =   DIGCLOCK.FRX:168E
  114.       Top             =   1920
  115.       Width           =   3705
  116.    End
  117.    Begin Image imgRed 
  118.       Height          =   525
  119.       Left            =   0
  120.       Picture         =   DIGCLOCK.FRX:27FC
  121.       Top             =   2400
  122.       Width           =   3705
  123.    End
  124. Option Explicit
  125. Sub cmdEnd_Click ()
  126. End Sub
  127. Sub Form_Load ()
  128. Dim Success%
  129. Dim Temp
  130. Dim ReturnString As String
  131. Dim ReturnSize As Integer
  132. Dim CurrentPath As String
  133. Dim TempString As String
  134. ReturnString = Space$(128)
  135. ReturnSize = Len(ReturnString)
  136. Temp = GetPrivateProfileString("DigClock", "Left", "0", ReturnString, ReturnSize, "digclock.ini")
  137. ReturnString = Left(ReturnString, Temp)
  138. Me.Left = Val(ReturnString)
  139. ReturnString = Space$(128)
  140. Temp = GetPrivateProfileString("DigClock", "Top", "0", ReturnString, ReturnSize, "digclock.ini")
  141. ReturnString = Left(ReturnString, Temp)
  142. Me.Top = Val(ReturnString)
  143. ReturnString = Space$(128)
  144. Temp = GetPrivateProfileString("DigClock", "Color", "0", ReturnString, ReturnSize, "digclock.ini")
  145. ReturnString = Left(ReturnString, Temp)
  146. If Val(ReturnString) = 0 Then
  147.    picNumbers.Picture = imgRed.Picture
  148.    ClockColor = 0
  149.    picNumbers.Picture = imgGreen.Picture
  150.    ClockColor = 1
  151. End If
  152. ReturnString = Space$(128)
  153. Temp = GetPrivateProfileString("DigClock", "TimeFormat", "12", ReturnString, ReturnSize, "digclock.ini")
  154. ReturnString = Left(ReturnString, Temp)
  155. If Val(ReturnString) = 12 Then
  156.    TimeFormat = 12
  157.    TimeFormat = 24
  158. End If
  159. ReturnString = Space$(128)
  160. Temp = GetPrivateProfileString("DigClock", "OnTop", "0", ReturnString, ReturnSize, "digclock.ini")
  161. ReturnString = Left(ReturnString, Temp)
  162. If Val(ReturnString) = 1 Then
  163.    Success% = SetWindowPos(frmClock.hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
  164.    OnTop = 1
  165.    Success% = SetWindowPos(frmClock.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
  166.    OnTop = 0
  167. End If
  168. ReturnString = Space$(128)
  169. Temp = GetPrivateProfileString("DigClock", "SecondsOn", "0", ReturnString, ReturnSize, "digclock.ini")
  170. ReturnString = Left(ReturnString, Temp)
  171. If Val(ReturnString) = 1 Then
  172.    picClock.Width = 2500
  173.    pnlClock.Width = 2730
  174.    Me.Width = 2765
  175.    SecondsOn = 1
  176.    ' Turn on Colons
  177.    imgNum(2).Picture = picNumbers.GraphicCell(10)
  178.    imgNum(5).Picture = picNumbers.GraphicCell(10)
  179.    picClock.Width = 1560
  180.    pnlClock.Width = 1770
  181.    Me.Width = 1800
  182.    SecondsOn = 0
  183. End If
  184. Load frmOptions
  185. End Sub
  186. Sub Form_Unload (Cancel As Integer)
  187. Dim Temp
  188. Dim TempString As String
  189. TempString = Trim(Str(Me.Left))
  190. Temp = WritePrivateProfileString("DigClock", "Left", TempString, "digclock.ini")
  191. TempString = Trim(Str(Me.Top))
  192. Temp = WritePrivateProfileString("DigClock", "Top", TempString, "digclock.ini")
  193. TempString = Trim(Str(OnTop))
  194. Temp = WritePrivateProfileString("DigClock", "OnTop", TempString, "digclock.ini")
  195. TempString = Trim(Str(ClockColor))
  196. Temp = WritePrivateProfileString("DigClock", "Color", TempString, "digclock.ini")
  197. TempString = Trim(Str(TimeFormat))
  198. Temp = WritePrivateProfileString("DigClock", "TimeFormat", TempString, "digclock.ini")
  199. TempString = Trim(Str(SecondsOn))
  200. Temp = WritePrivateProfileString("DigClock", "SecondsOn", TempString, "digclock.ini")
  201. End Sub
  202. Sub imgNum_MouseUp (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  203. Dim mpos As POINTAPI
  204. Dim p As ConvertPOINTAPI
  205. Dim ret As Integer
  206. Call GetCursorPos(mpos) ' Get the current position of the cursor
  207. LSet p = mpos           ' and convert it for SendMessage calls.
  208. ' Now tell the form someone is clicking the window caption:
  209. ret = Sendmessage(Me.hWnd, WM_SYSCOMMAND, MOUSE_MOVE, p.xy)
  210. End Sub
  211. Sub Picture1_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  212. Dim mpos As POINTAPI
  213. Dim p As ConvertPOINTAPI
  214. Dim ret As Integer
  215. Call GetCursorPos(mpos) ' Get the current position of the cursor
  216. LSet p = mpos           ' and convert it for SendMessage calls.
  217. ' Now tell the form someone is clicking the window caption:
  218. ret = Sendmessage(Me.hWnd, WM_SYSCOMMAND, MOUSE_MOVE, p.xy)
  219. End Sub
  220. Sub pnlClock_DblClick ()
  221. frmOptions.Show
  222. End Sub
  223. Sub pnlMenu_DblClick ()
  224. frmOptions.Show
  225. End Sub
  226. Sub Timer1_Timer ()
  227. Dim Current
  228. Dim X As Integer
  229. If TimeFormat = 12 And SecondsOn = 0 Then
  230.    Current = Format(Now, "HH:MM AM/PM")
  231. End If
  232. If TimeFormat = 24 And SecondsOn = 0 Then
  233.    Current = Format(Now, "HH:MM")
  234. End If
  235. If TimeFormat = 12 And SecondsOn = 1 Then
  236.    Current = Format(Now, "HH:MM:SS AM/PM")
  237. End If
  238. If TimeFormat = 24 And SecondsOn = 1 Then
  239.    Current = Format(Now, "HH:MM:SS")
  240. End If
  241. If Current <> OldTime Then
  242.    If Left(Current, 1) = "0" Then
  243.       imgNum(0).Picture = picNumbers.GraphicCell(12)
  244.    Else
  245.       imgNum(0).Picture = picNumbers.GraphicCell(Val(Left(Current, 1)))
  246.    End If
  247.    X = Val(Mid(Current, 2, 1))
  248.    imgNum(1).Picture = picNumbers.GraphicCell(X)
  249.    X = Val(Mid(Current, 4, 1))
  250.    imgNum(3).Picture = picNumbers.GraphicCell(X)
  251.    X = Val(Mid(Current, 5, 1))
  252.    imgNum(4).Picture = picNumbers.GraphicCell(X)
  253.    If SecondsOn Then
  254.       X = Val(Mid(Current, 7, 1))
  255.       imgNum(6).Picture = picNumbers.GraphicCell(X)
  256.       X = Val(Mid(Current, 8, 1))
  257.       imgNum(7).Picture = picNumbers.GraphicCell(X)
  258.    End If
  259. End If
  260. If SecondsOn = 0 Then
  261.    If ColonOn Then
  262.       ColonOn = False
  263.       imgNum(2).Picture = picNumbers.GraphicCell(11)
  264.    Else
  265.       ColonOn = True
  266.       imgNum(2).Picture = picNumbers.GraphicCell(10)
  267.    End If
  268. End If
  269. End Sub
  270.